package com.guchenbo.spark.sql;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RedexDd {

  public static void main(String[] args) {
    String re = "with (.*) as \\((.*)\\) insert overwrite table(.*)";
    Pattern pattern = Pattern.compile(re);
    String in = "with ds_t3126 as ( SELECT a.*,b.name AS nameb FROM model_manager.model_info a LEFT JOIN model_manager.model_form_template b ON (a.form_template_uuid = b.uuid) ) insert overwrite table turing_monitor.template_183_table_0 select * from (( select name as v1,nameb as v2 from ds_t3126 ) as field_0)";

    Matcher matcher = pattern.matcher(in);
    matcher.find();
    System.out.println(matcher.group(1));
    System.out.println(matcher.group(2));
    System.out.println(matcher.group(3));
  }
}
